<?php
namespace App\Http\Routes;

use Illuminate\Contracts\Routing\Registrar;

class ApiRoutes {

    public function map(Registrar $router)
    {
        $prefix = 'api/';
        $router->group(['prefix' => $prefix], function($router) {
            $this->index($router);
            $this->pKApiRoute($router);
            $this->goldRcord($router);
            $this->sign($router);
            $this->mainPage($router);
        });
    }

    private function index($router){
        $router->get('/login/index', 'Api\LoginController@index');
        $router->get('/login/details', 'Api\LoginController@details');
        $router->get('/login/user_details', 'Api\LoginController@user_details');
        $router->get('/login/phone', 'Api\LoginController@phone');
        $router->get('/yu/login/index', 'Api\YLoginController@index');
        $router->any('/yu/login/register', 'Api\YLoginController@register');
    }
    private function pKApiRoute($router){
        $router->get('/apiPk/addPkApi', 'Api\ApiPkController@addPkApi');//创建并发起PK
        $router->get('/apiPk/recivePkApi', 'Api\ApiPkController@recivePkApi');//扫码进入PK
        $router->get('/apiPk/addApi', 'Api\ApiPkController@addApi');//加入PK
        $router->get('/apiPk/resultPkApi', 'Api\ApiPkController@resultPkApi');//提交pk
        $router->get('/apiPk/cancelPkApi', 'Api\ApiPkController@cancelPkApi');//取消pk
        $router->get('/apiPk/waitPkApi', 'Api\ApiPkController@waitPkApi');//获取PK二维码
        $router->get('/apiPk/pkResultReply', 'Api\ApiPkController@pkResultReply');//等待PK
        $router->get('/apiPk/checkPkApi', 'Api\ApiPkController@checkPkApi');//等待PK
        $router->get('/apiPk/recgetmasterApi', 'Api\ApiPkController@recgetmasterApi');//等待PK
        $router->get('/apiPk/exchange', 'Api\ApiPkController@exchange');//兑换
        $router->get('/apiPk/checkNowPk', 'Api\ApiPkController@checkNowPk');//检查是否有正在pk的数据
        $router->get('/merchant/qrcode', 'Api\QrcodeController@index');//获取签到和商城兑换的接口
    }
    private function goldRcord($router){
        $router->get('/apiGoldRecord/index', 'Api\ApiGoldRecordController@index');//获取豆子明细
        $router->get('/apiGoldRecord/iNowGold', 'Api\ApiPkController@checkGold');//获取当前金豆数
    }
    //签到路由
    private function sign($router){
        $router->get('/apiSign/index', 'Api\ApiSignController@index');//签到
        $router->get('/apiSign/addGold', 'Api\ApiSignController@addGold');//签到
    }
    //主页路由
    private function mainPage($router){
        $router->get('/apiMain/index', 'Api\MainController@index');//主页路由
        $router->get('/apiMain/details', 'Api\MainController@details');//details
        $router->get('/apiMain/main', 'Api\MainController@main');//我的路由接口
        $router->get('/apiMain/myFriend', 'Api\MainController@myFriend');//我的路由接口
    }

}